Skip to content

feat: Add comprehensive SEO build-time data, sitemap generation, and webmaster analytics tracking#108

Open
OsakaLOOP wants to merge 1 commit intobefore-refractorfrom
jules-10289299139600741089-675db787
Open

feat: Add comprehensive SEO build-time data, sitemap generation, and webmaster analytics tracking#108
OsakaLOOP wants to merge 1 commit intobefore-refractorfrom
jules-10289299139600741089-675db787

Conversation

@OsakaLOOP
Copy link
Copy Markdown
Owner

This PR implements a robust, locally generated, zero-server-dependency SEO and Analytics solution as requested.

  1. SEO Local Generation: Added npm run prebuild step executing scripts/build_seo_data.js. It traverses the locale/changelog files for UI text and features, and parses company_data.json and any geojson/*.geojson for company, line, and station names. This gets built into public/seo_data.json.
  2. Build-Time Injection: vite.config.js now uses this JSON to inject highly targeted meta description, keywords and structured ld+json (Schema WebSite) directly into the built index.html.
  3. Sitemap: Added vite-plugin-sitemap to ensure sitemap.xml covers the root domain https://rail.s3xyseia.xyz accurately.
  4. Tracking Events: Wrapped GA4, Baidu Tongji (_hmt.push), and Bing UET (uetq.push) in a unified trackEvent interface in src/utils/analytics.ts. Added tracking logic into Modals (Login, Trip Edit, Github, Folders, Pins) and layout buttons (Import/Export).
  5. Anchors: Webmaster tracking script tags added to index.html pulling from %VITE_BAIDU_TONGJI_ID% and %VITE_BING_UET_ID%.
  6. Submission Scripts: Written a Node API push script scripts/submit_search_engines.js relying securely on environment tokens for Bing and Baidu to help index the newly created sitemap.

PR created automatically by Jules for task 10289299139600741089 started by @OsakaLOOP

- Built a custom `scripts/build_seo_data.js` to automatically extract text from localization files, changelog, and geojson/company datasets to generate `public/seo_data.json`.
- Integrated `vite-plugin-sitemap` and a custom Vite plugin into `vite.config.js` to dynamically generate a `/sitemap.xml` and inject `ld+json` and SEO meta tags into `index.html` at build time.
- Set up a utility `src/utils/analytics.ts` to manage event routing for Google Analytics (GA4), Baidu Tongji, and Bing UET.
- Injected generic tracking anchors in `index.html` allowing dynamic IDs via environment variables.
- Hand-instrumented critical user actions throughout the React components, including: User Registration, Login, Backup JSON Import/Export, KML Export, Adding/Editing Trips, Auto-routing, Adding/Editing Pins, and Folder Management.
- Created `scripts/submit_search_engines.js` to automatically ping/push URLs to Google, Bing, and Baidu webmaster APIs.

Co-authored-by: OsakaLOOP <68284076+OsakaLOOP@users.noreply.github.com>
@google-labs-jules
Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant